Can you call a DXL from another DXL and pass data between the two?

I was wondering if there was a way to call a DXL with some sort of command line parameters associated with it. So for instance, if I had a DXL script that gathered a list of module names, could I call another DXL script, passing it that data, and have it do its thing with the list of Module names? I know they say DXL is based on C/C++, I'm just hoping it has this type of functionality.
Thanks

Greg
GregNowak - Wed Feb 10 15:02:40 EST 2010

Re: Can you call a DXL from another DXL and pass data between the two?
Peter_Albert - Thu Feb 11 04:05:27 EST 2010

The DXL help is, admittedly, not very good, but sometimes it can help as a starting point for your own experiments.

If you have a look at how e.g. the "print" command is defined (a good starting point, as obviously a "print" command without the option to pass parameters is not very useful), you'll see

void print(string s)

which pretty much is the answer to your question.

Your actual problem is slightly more complicated, as you don't know in advance how many module names you will collect, so you would naturally not use one of the fundamental types, but rather a Skip list, a code fragment could look like

Skip getModuleNames()
{ // This is the script which gathers the list of module names
  Skip returnSkip = createString
  string aModuleName
  do_and_kind_of_loop_here
  {
    put(returnSkip, aModuleName, aModuleName)
  }
  return returnSkip
} // This is the script which gathers the list of module names
 
void doSomethingWithList(Skip moduleList)
{ // This is the script which does something useful with the module list
  string aModuleName
  for aModuleName in moduleList
  {
    doSomethingWithModule(aModuleName)
  }
} // This is the script which does something useful with the module list
 
// Main
 
Skip moduleList = getModuleNames()
doSomethingWithList(moduleList)
delete moduleList

 


Regards,

Peter

 

Re: Can you call a DXL from another DXL and pass data between the two?
llandale - Mon Feb 15 18:33:52 EST 2010

I had a 'CloseInvisibleModules' script that you could run from the Explorer; it closes invisible modules. I tried to #include that script from another script, one that opens lots of modules while following links. It didn't work, DXL nesting is more or less a nightmare. Ended up putting the meat of 'CloseInvisibleModules' in a library include file, #included by both programs.

You can use the "string Results = eval_(string)" command to invoke and execute a script. There are limitations. You can only pass string variables so complicated structures are out of the question (like Skip lists), but you could convert your open module to a string Name, then have the evaluated code convert that back into an open Module handle. This method doesn't really solve complicated problems, but I have managed to use it for DXL containing recent DXL features, when I need that DXL to work reasoanbly well in versions of DOORS that don't have those features. that is, the DXL errors occur in the eval code, are trapped and ignored, not in the main code.

I made a reasonable but eventually feeble effort at using Environment Variables to house DXL script communication, and managed to fire off a 'train' of DXL scripts with that method.

You could store information in configuration files stored in the data base.

All in all, only the most troublesome, massive, and complicated scripts may have a real need to do this, probably better of having using library functions and letting the first script do both chores.

  • Louie

Re: Can you call a DXL from another DXL and pass data between the two?
SystemAdmin - Wed Feb 17 17:49:29 EST 2010

I'm assuming that you're running two different DXL scripts at different times, otherwise you'd just function-ize your calls. Or there's something else going on that you're not describing.

Anyways, you could serialize your data into a file, then the string you pass eval is that filename.

If you have two concurrently running DXL scripts, you could IPC.

Re: Can you call a DXL from another DXL and pass data between the two?
GregNowak - Thu Feb 18 13:40:56 EST 2010

llandale - Mon Feb 15 18:33:52 EST 2010
I had a 'CloseInvisibleModules' script that you could run from the Explorer; it closes invisible modules. I tried to #include that script from another script, one that opens lots of modules while following links. It didn't work, DXL nesting is more or less a nightmare. Ended up putting the meat of 'CloseInvisibleModules' in a library include file, #included by both programs.

You can use the "string Results = eval_(string)" command to invoke and execute a script. There are limitations. You can only pass string variables so complicated structures are out of the question (like Skip lists), but you could convert your open module to a string Name, then have the evaluated code convert that back into an open Module handle. This method doesn't really solve complicated problems, but I have managed to use it for DXL containing recent DXL features, when I need that DXL to work reasoanbly well in versions of DOORS that don't have those features. that is, the DXL errors occur in the eval code, are trapped and ignored, not in the main code.

I made a reasonable but eventually feeble effort at using Environment Variables to house DXL script communication, and managed to fire off a 'train' of DXL scripts with that method.

You could store information in configuration files stored in the data base.

All in all, only the most troublesome, massive, and complicated scripts may have a real need to do this, probably better of having using library functions and letting the first script do both chores.

  • Louie

Maybe I need a bit more explanation on the eval_ function. Is the string passed the DXL location? Such as:

string result = eval_(doorsHome "lib\\dxl\\addins\\user\\example.dxl")


because I can't seem to get that to work. It just throws the error "undeclared variable C", which is coming from the doorsHome command, which for me returns C:\Program Files\Telelogic\DOORS_8.3\

I want to run one DXL script completely, then run another script but I want to pass the 2nd script some of the information gathered in the first script. I could just make them one big script or throw the contents into an include file (which is what I ended up doing). What I was leading up to was the ability to run a script from the command line and pass it some data. I'd like to have my DXL script communicate with a program written in C++.

Greg

Re: Can you call a DXL from another DXL and pass data between the two?
Mathias Mamsch - Thu Feb 18 15:12:07 EST 2010

GregNowak - Thu Feb 18 13:40:56 EST 2010

Maybe I need a bit more explanation on the eval_ function. Is the string passed the DXL location? Such as:

string result = eval_(doorsHome "lib\\dxl\\addins\\user\\example.dxl")


because I can't seem to get that to work. It just throws the error "undeclared variable C", which is coming from the doorsHome command, which for me returns C:\Program Files\Telelogic\DOORS_8.3\

I want to run one DXL script completely, then run another script but I want to pass the 2nd script some of the information gathered in the first script. I could just make them one big script or throw the contents into an include file (which is what I ended up doing). What I was leading up to was the ability to run a script from the command line and pass it some data. I'd like to have my DXL script communicate with a program written in C++.

Greg

eval_ (string ) does not take a file as a parameter. It takes valid DXL code like "print \"Hello\"". So you need to put an "#include <...>" statement into the evaluated code, not just a filename.

Regards, Mathias

Re: Can you call a DXL from another DXL and pass data between the two?
roybond - Fri Feb 19 08:30:22 EST 2010

Mathias Mamsch - Thu Feb 18 15:12:07 EST 2010
eval_ (string ) does not take a file as a parameter. It takes valid DXL code like "print \"Hello\"". So you need to put an "#include <...>" statement into the evaluated code, not just a filename.

Regards, Mathias

You also need a 'return_ ("string")' statement in the included DXL Code to pass back your data.

Roy.

Re: Can you call a DXL from another DXL and pass data between the two?
llandale - Tue Feb 23 12:45:21 EST 2010

GregNowak - Thu Feb 18 13:40:56 EST 2010

Maybe I need a bit more explanation on the eval_ function. Is the string passed the DXL location? Such as:

string result = eval_(doorsHome "lib\\dxl\\addins\\user\\example.dxl")


because I can't seem to get that to work. It just throws the error "undeclared variable C", which is coming from the doorsHome command, which for me returns C:\Program Files\Telelogic\DOORS_8.3\

I want to run one DXL script completely, then run another script but I want to pass the 2nd script some of the information gathered in the first script. I could just make them one big script or throw the contents into an include file (which is what I ended up doing). What I was leading up to was the ability to run a script from the command line and pass it some data. I'd like to have my DXL script communicate with a program written in C++.

Greg

string result = eval_("#include <"lib\\dxl\\addins\\user\\example.dxl>")

 


'Command Line Parameters' are for the DOORS program, there is no such thing for DXL. You could, however, write a Function that acted like it took variable Command Line Parameters. Pass it a string and let it parse it.

Perhaps one DXL could write to a File (on the hard drive) or a Config File (inside the database).

 

 

// DXL 1
Buffer bufPassedInfo = "whatever I want to send to the 2nd DXL\n2nd line of Info"
ConfStream cs = confWrite("Dxl1-Dxl2-Info.txt", confSystem)
cs << bufPassedInfo
close(cs)
 
// DXL 2
ConfStream cs = confRead("Dxl1-Dxl2-Info.txt", confSystem)
PassedInfo = ""
while (true)
{  cs >> PassedInfo
   Deal with this line of information(PassedInfo)
   if (end cs) break
}
close(cs)


Didn't debug it, perhaps its not quite right.

 

 

 

  • Louie

 

 

Re: Can you call a DXL from another DXL and pass data between the two?
GregNowak - Tue Feb 23 13:00:55 EST 2010

Thanks Louie, you confirmed what I was afraid of. I knew I could read/write to a file for communication between programs, which is what I ended up doing. So, in summary, I took the output of one DXL, wrote it to a file, then read that input from the second DXL file. This is also how I communicated with a C# command line tool, since DXL can only call the System() function, not read in the output from the command line.
Thanks everyone
Greg

Re: Can you call a DXL from another DXL and pass data between the two?
Mathias Mamsch - Thu Feb 25 11:02:58 EST 2010

GregNowak - Tue Feb 23 13:00:55 EST 2010
Thanks Louie, you confirmed what I was afraid of. I knew I could read/write to a file for communication between programs, which is what I ended up doing. So, in summary, I took the output of one DXL, wrote it to a file, then read that input from the second DXL file. This is also how I communicated with a C# command line tool, since DXL can only call the System() function, not read in the output from the command line.
Thanks everyone
Greg

Greg, that is not true. DXL can read the output from the commandline.

Under windows try:
 

string result = ""
print win32SystemWait_ ("cmd.exe /C dir", result, -1)
print "Output: " result "\n"

 


Regards, Mathias

 

Re: Can you call a DXL from another DXL and pass data between the two?
GregNowak - Thu Feb 25 12:59:55 EST 2010

Mathias Mamsch - Thu Feb 25 11:02:58 EST 2010

Greg, that is not true. DXL can read the output from the commandline.

Under windows try:
 

string result = ""
print win32SystemWait_ ("cmd.exe /C dir", result, -1)
print "Output: " result "\n"

 


Regards, Mathias

 

Is there a detailed API somewhere that I've just missed? I've never heard of this system32Wait_ function (along with many other functions I'm comming accross in these Forums). This would have been helpful to know about a month ago, before I started doing all my creations and deletions because I couldn't get the return from the command line. When I saw in the "help" that System was a void, I assumed you could only make system calls, not get the return from them. Silly me i guess!
Thanks though,

Greg

Re: Can you call a DXL from another DXL and pass data between the two?
Mathias Mamsch - Thu Feb 25 14:21:11 EST 2010

GregNowak - Thu Feb 25 12:59:55 EST 2010
Is there a detailed API somewhere that I've just missed? I've never heard of this system32Wait_ function (along with many other functions I'm comming accross in these Forums). This would have been helpful to know about a month ago, before I started doing all my creations and deletions because I couldn't get the return from the command line. When I saw in the "help" that System was a void, I assumed you could only make system calls, not get the return from them. Silly me i guess!
Thanks though,

Greg

I guess doing stuff in DXL is all about asking the right questions :-) But you are right, the "DXL help" is useful to a certain point and after that you have to figure out stuff by yourself, which takes some time.

There are two undocumented DXL sources.

For one there are a lot of undocumented perms in DXL - some of them are just to enable the crazy DXL syntax (which needs like 1000 undocumented types), some have just been forgotten in the documentation by Telelogic/IBM, some are supposed to be "hidden" from the normal users and just used by Telelogic/IBM in the DXL part of the DOORS client, some for fixing stuff, etc. A good starting point is the "undocumented perms" list which you can find on smartdxl.com (it is not complete, but nearly complete).

The second source of undocumented DXL is the DOORS client itself - the DOORS Database explorer is written completly in DXL, the menus of the Module editor are mostly DXL while the module editor itself is hardcoded in the doors.exe. So when you run the DOORS client there are lots of functions already defined in the global DXL context (the whole stuff that the startup.inc file loads) and you can find useful functions like how to get the currently selected item in the database explorer. You can get information about this stuff only by looking at the decrypted include libraries of the DOORS client.

Regards, Mathias

Re: Can you call a DXL from another DXL and pass data between the two?
HiLbiLy - Wed Mar 17 14:25:41 EDT 2010

Mathias Mamsch - Thu Feb 25 14:21:11 EST 2010
I guess doing stuff in DXL is all about asking the right questions :-) But you are right, the "DXL help" is useful to a certain point and after that you have to figure out stuff by yourself, which takes some time.

There are two undocumented DXL sources.

For one there are a lot of undocumented perms in DXL - some of them are just to enable the crazy DXL syntax (which needs like 1000 undocumented types), some have just been forgotten in the documentation by Telelogic/IBM, some are supposed to be "hidden" from the normal users and just used by Telelogic/IBM in the DXL part of the DOORS client, some for fixing stuff, etc. A good starting point is the "undocumented perms" list which you can find on smartdxl.com (it is not complete, but nearly complete).

The second source of undocumented DXL is the DOORS client itself - the DOORS Database explorer is written completly in DXL, the menus of the Module editor are mostly DXL while the module editor itself is hardcoded in the doors.exe. So when you run the DOORS client there are lots of functions already defined in the global DXL context (the whole stuff that the startup.inc file loads) and you can find useful functions like how to get the currently selected item in the database explorer. You can get information about this stuff only by looking at the decrypted include libraries of the DOORS client.

Regards, Mathias

I can't seem to find the 'undocumented perms' on the smartdxl website. can you provide a complete link?

Also how do you decrypt the include libraries? Of are you just refering to the scripts that IBM has chosen not to encrypt?

Thanks

Re: Can you call a DXL from another DXL and pass data between the two?
HiLbiLy - Wed Mar 17 14:42:29 EDT 2010

Mathias Mamsch - Thu Feb 25 14:21:11 EST 2010
I guess doing stuff in DXL is all about asking the right questions :-) But you are right, the "DXL help" is useful to a certain point and after that you have to figure out stuff by yourself, which takes some time.

There are two undocumented DXL sources.

For one there are a lot of undocumented perms in DXL - some of them are just to enable the crazy DXL syntax (which needs like 1000 undocumented types), some have just been forgotten in the documentation by Telelogic/IBM, some are supposed to be "hidden" from the normal users and just used by Telelogic/IBM in the DXL part of the DOORS client, some for fixing stuff, etc. A good starting point is the "undocumented perms" list which you can find on smartdxl.com (it is not complete, but nearly complete).

The second source of undocumented DXL is the DOORS client itself - the DOORS Database explorer is written completly in DXL, the menus of the Module editor are mostly DXL while the module editor itself is hardcoded in the doors.exe. So when you run the DOORS client there are lots of functions already defined in the global DXL context (the whole stuff that the startup.inc file loads) and you can find useful functions like how to get the currently selected item in the database explorer. You can get information about this stuff only by looking at the decrypted include libraries of the DOORS client.

Regards, Mathias

I found the perms.
Thanks

Re: Can you call a DXL from another DXL and pass data between the two?
GregNowak - Wed Mar 17 15:26:25 EDT 2010

HiLbiLy - Wed Mar 17 14:42:29 EDT 2010
I found the perms.
Thanks

May I suggest a few things?
First, I'm glad you found the perms. They help out a lot!
Second, If you use Eclipse (for Java or C/C++ etc...) or are familar with the IDE at all, I would download the DXL Editor by SODIUS
http://www.dxleditor.com/dxleditor
It is 100% free, you simply apply for a license file (takes about 24 hours) and they send it to you via Email. Their autocomplete option isn't as nice as Java, but it works well enough. I'd watch the view a few times after you get it to learn all the features, but it has cut my coding time in half. It runs scripts directly from eclipse (you must have DOORS running in the background), auto-compiling, etc...
I know it sounds like I work for them, but I'm just really excited that I found this tool.

Regards,

Greg

Re: Can you call a DXL from another DXL and pass data between the two?
vasgyuszi - Thu Mar 25 02:38:10 EDT 2010

HiLbiLy - Wed Mar 17 14:42:29 EDT 2010
I found the perms.
Thanks

Please help on me also: where can I find the undocumented perms?

THX!
vasgyuszi

Re: Can you call a DXL from another DXL and pass data between the two?
SystemAdmin - Thu Mar 25 05:47:57 EDT 2010

vasgyuszi - Thu Mar 25 02:38:10 EDT 2010
Please help on me also: where can I find the undocumented perms?

THX!
vasgyuszi

SmartDXL: Programming page

http://www.smartdxl.com/content/?page_id=163

Re: Can you call a DXL from another DXL and pass data between the two?
vasgyuszi - Thu Mar 25 06:59:25 EDT 2010

SystemAdmin - Thu Mar 25 05:47:57 EDT 2010
SmartDXL: Programming page

http://www.smartdxl.com/content/?page_id=163

Big thanks Pekka! I was blind obviously ;)

vasgyuszi